package com.zw.admin.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zw.admin.server.model.PSaleOrders;

@Mapper
public interface PSaleOrdersDao {

    @Select("select * from p_sale_orders t where t.id = #{id}")
    PSaleOrders getById(Long id);

    @Delete("delete from p_sale_orders where id = #{id}")
    int delete(Long id);

    int update(PSaleOrders pSaleOrders);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into p_sale_orders(order_no, buydate, status, quantity, sale_amount, amount, pay_amount, createTime, updateTime) values(#{orderNo}, #{buydate}, #{status}, #{quantity}, #{saleAmount}, #{amount}, #{payAmount}, #{createTime}, #{updateTime})")
    int save(PSaleOrders pSaleOrders);
    
    int insert(PSaleOrders pSaleOrders);
    
    int count(@Param("params") Map<String, Object> params);

    List<PSaleOrders> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
